<template>
    <div class="hello">
        {{city}}
    </div>
</template>
<script>
export default {
    name: 'HelloWorld',
    data(){
      return{
        city:""
      }
    },
    created() {
    //保存vue实例，因为在axios中，this指向的就不是vue实例了，而是axios
 
    this.axios.get('/api')
            .then(function (response) {
              that.city =response.data.city
              console.log(response);
            })
            .catch(function(error){
              console.log(error);
            })
    }
}
</script>
